let expression1: Interpreter.expr = (Cst(3), (Cst(2), Cst(1))->Mul)->Add
assert (5 == expression1->Interpreter.eval(list{}))
let expression2: Interpreter.expr = Let("x", Add(Cst(1), Cst(2)), Var("x"))

let opcode1: Stack.instrs = list{Cst(1), Cst(2), Add, Cst(3), Mul}
assert (Stack.eval(opcode1, list{}) == 9)

let opcode2: Stack.instrs = list{Cst(1), Cst(2), Var(0), Add}
assert (Stack.eval(opcode2, list{}) == 4)

let opcode3: Stack.instrs = list{Cst(2), Cst(4), Var(0), Var(2), Add, Mul, Add}
assert (Stack.eval(opcode3, list{}) == 26)

let compiled1 = Compiler.compile(Compiler.comp(expression1, list{}))
assert (Stack.eval(compiled1, list{}) == 5)

let compiled2 = Compiler.SinglePass.compile(expression1)
assert (Stack.eval(compiled1, list{}) == 5)

let compiled3 = Compiler.compile(Compiler.comp(expression2, list{}))
assert (Stack.eval(compiled3, list{}) == 3)

let compiled4 = Compiler.SinglePass.compile(expression2)
assert (Stack.eval(compiled4, list{}) == 3)
